package com.vivachek.protocol.enums

import com.vivachek.protocol.exception.NotSupportProtocolException


/**
 * @Author: YCB
 * @Time: 2022/9/29 15:20
 * @Email: congbin.yuan@vivachek.com
 * @Description: 单位枚举
 *
 */
enum class UnitEnums(val type:Int,val unit:String) {

    MMOL(34,"mmol/L"),
    MG(17,"mg/dL"),

    UMOL(51,"µmol/L")
    ;

    companion object{
        fun convert(type:Int):UnitEnums{
            values().forEach {
                if (it.type==type) {
                    return it
                }
            }
            throw NotSupportProtocolException("无法解析单位:$type")
        }
    }
}